package com.dove.common;

import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;

@Aspect
@Configuration
public class WebLogAcpect {

	private Logger logger = LoggerFactory.getLogger(this.getClass());

	/**
	 * 定义切入点，切入点为com.example.aop下的所有函数
	 */
	@Pointcut("execution(* com.dove.controller.UsersController.*(..))")
	public void userOrderController() {
	}

	// 在本类的cutController执行之前
	@Before("userOrderController()")
	public void beforeUserOrderController() {
		logger.info("before");
	}

	// 在本类的cutController执行之后执行
	@After("userOrderController()")
	public void afterUserOrderController() {
		logger.info("after");
	}
}
